package de.slothsoft.wasbinich.core.database;

public class DatabaseException extends Exception {

    private static final long serialVersionUID = 5882205201736254297L;

    private final DatabaseExceptionCode code;

    public DatabaseException(DatabaseExceptionCode code, Throwable throwable) {
	super(throwable);
	this.code = code;
    }

    public DatabaseException(DatabaseExceptionCode code, String detailMessage) {
	super(detailMessage);
	this.code = code;
    }

    public DatabaseException(DatabaseExceptionCode code, String detailMessage, Throwable throwable) {
	super(detailMessage, throwable);
	this.code = code;
    }

    public DatabaseExceptionCode getCode() {
	return this.code;
    }

    @Override
    public String getMessage() {
	return this.code.getMessage();
    }

}
